// $Id: iOfflineFile.h 4950 2006-08-14 03:15:13Z paul $

#ifndef _iOfflineFile_h_
#define _iOfflineFile_h_

#include <vector>
#include <string>

class TFile;
class TTree;
class TBranch;

namespace evt {
  class Event;
}

namespace io {
  class Event_ROOT;
  class Config_ROOT;
}

namespace iOF {

  /**
  \class iOfflineFile

  \brief ROOT streamer for top level offline format

  \ingroup offline_io
   */

  class iOfflineFile
  {

    public:
      iOfflineFile();
      iOfflineFile(std::string filename);
      ~iOfflineFile();

      bool Open(std::string filename);
      bool Close();


    /// Returns -1 if End Of File
      bool ReadEvent(evt::Event& event);
      bool ReadOnlySHeaderAndSTrigger(evt::Event& event);

    /// Returns the number of events whith central trigger in the file
      int GetNEvents();

    /// Set the current event
      bool SetCurEventNo(int curEventNo);
      
    /// Return a string with the configuration corresponding to the run.
    /** The configuration returned is a concatenation of all
      config files accessed during the run which produced
      the current iOfflineFile */
      std::string GetConfig();
    
    private:
      int fNoEvents;
      int fCurEventNo;
      TFile *inputFile;
      TTree *fTree;
      TBranch* fBranch;
      TBranch* fConfigBranch;
      io::Event_ROOT* fCurEvent;
      io::Config_ROOT* fConfig;
  };
}

#endif


// Configure (x)emacs for this file ...
// Local Variables:
// mode: c++
// End:
